#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include <vector>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll mod = 1000000000;
int n, m;
int dx[] =
{ 1, 0, -1, 0 };
int dy[] =
{ 0, 1, 0, -1 };
bool check(int x, int y)
{
	return x >= 0 && x < n && y >= 0 && y < m;
}
int mp[20][20];
ll a[82][82];
ll det(ll a[][82], int n)
{
	ll ret = 1;
	for (int i = 1; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
			while (a[j][i])
			{
				ll t = a[i][i] / a[j][i];
				for (int k = i; k < n; k++)
					a[i][k] = (a[i][k] - a[j][k] * t) % mod;
				for (int k = i; k < n; k++)
					swap(a[i][k], a[j][k]);
				ret = -ret;
			}
		if (a[i][i] == 0)
			return 0;
		ret = ret * a[i][i] % mod;
	}
	return (ret % mod + mod) % mod;
}
void sol()
{
	char s[20];
	scanf("%d%d", &n, &m);
	int tot = 0;
	memset(mp, -1, sizeof(mp));
	for (int i = 0; i < n; ++i)
	{
		scanf("%s", s);
		for (int j = 0; j < m; ++j)
		{
			if (s[j] == '.')
				mp[i][j] = tot++;
		}
	}
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			if (mp[i][j] != -1)
			{
				for (int d = 0; d < 4; ++d)
				{
					int gox = i + dx[d];
					int goy = j + dy[d];
					if (check(gox, goy) && mp[gox][goy] != -1)
					{
						a[mp[i][j]][mp[i][j]]++;
						a[mp[i][j]][mp[gox][goy]]--;
					}
				}
			}
		}
	}
	ll ans = det(a, tot);
	cout << ans << endl;
}
int main()
{

	sol();
}
